/*
 * Copyright (c) 2014, 2015, XIANDIAN and/or its affiliates. All rights reserved.
 * XIANDIAN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 */
package com.cust.zy.newtask.tools;

public class TaskResult<Type> {

	/** The exception. */
	private Exception exception;

	/** The result. */
	private Type result;

	/**
	 * Instantiates a new task result.
	 * 
	 * @param result
	 *            the result
	 */
	public TaskResult(final Type result) {
		this.result = result;
	}

	/**
	 * Instantiates a new task result.
	 * 
	 * @param exception
	 *            the exception
	 */
	public TaskResult(final Exception exception) {
		this.exception = exception;
	}

	/**
	 * Checks if is valid.
	 * 
	 * @return true, if is valid
	 */
	public final boolean isValid() {
		return exception==null;
	}

	/**
	 * Gets the exception.
	 * 
	 * @return the exception
	 */
	public final Exception getException() {
		return exception;
	}

	/**
	 * Gets the result.
	 * 
	 * @return the result
	 */
	public final Type getResult() {
		return result;
	}
}
